package com.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.common.utils.PageUtils;
import com.common.utils.Query;
import com.dao.FillQuestionDao;
import com.entity.FillQuestionEntity;
import com.service.FillQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("fillQuestionService")
public class FillQuestionServiceImpl extends ServiceImpl<FillQuestionDao, FillQuestionEntity> implements FillQuestionService {

    @Autowired
    private FillQuestionDao fillQuestionDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<FillQuestionEntity> page = this.page(
                new Query<FillQuestionEntity>().getPage(params),
                new QueryWrapper<FillQuestionEntity>()
                        .or().like("questionid",params.get("key"))
                        .or().like("subject",params.get("key"))
                        .or().like("level",params.get("key"))
                        .or().like("section",params.get("key"))
        );

        return new PageUtils(page);
    }

    @Override
    public List<FillQuestionEntity> getAllList() {
        return fillQuestionDao.selectList(new QueryWrapper<>());
    }

}